package com.invest.mapper;

import com.invest.domain.entity.CbData;
import com.invest.domain.entity.RiskFree;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 可转债数据Mapper接口
 *
 * @author yuch
 * @date 2025-01-05
 */
@Mapper
public interface RiskFreeMapper
{

    @Select("select * from risk_free where time = #{time}")
    public RiskFree selectByTime(String time);
    @Select("SELECT ten_year_rate FROM risk_free ORDER BY update_time DESC LIMIT 1")
    public String getLatestRate();


    @Insert("INSERT INTO risk_free (  ten_year_rate, time, one_year_rate,update_time) VALUES (  #{tenYearRate}, #{time}, #{oneYearRate}, #{updateTime})")
    public int insertRiskFree( RiskFree riskFree);


    @Update("UPDATE risk_free SET  ten_year_rate = #{tenYearRate}, update_time = #{updateTime}, one_year_rate = #{oneYearRate} WHERE id = #{id}")
    public int updateRiskFree( RiskFree  riskFree);







}
